Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

336
Visualizações
Socket.io throw connect_error "server error" after moving to a different domain name

This is the extension of my last question here:

socket.io always has connection false

For now, I have two servers deployed in two different domain names. The first server works perfectly fine with socket.io, so I redeployed the server to the new domain name by simply pull the same branch from GitHub, install everything and run it. And then I found that all my socket.io connections failed and the symptom is exactly the same as last time: connection always 'false' and disconnection always 'true'.

This time I am pretty sure it is not related with cors, because I tried io.origins((origin, cb) => if (whitelist.includes(origin)) { cb(null, true) } else { cb('failed', false) ) and it shows the origin is allowed.

I also tried cors: { origin: '*' } and that also doesn't work.

Strangely, despite the fact that they are using the same code, connecting to the first domain name works perfectly fine. But the second one has the issue.

UPDATE:

I use this to track the error message.

        this.socket.on('connect_error', function(err) {
            console.log(`connect_error due to ${err.message}`);
        });

And this is what is returned:

connect_error due to server error

In the mean time, on server side I can see nothing other than the new connections being created and being disconnected due to ping timeout.

Where can I find more information to help me debug?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Turns out I forgot to run npm i after deploying to a new domain name. The version of socket.io wasn't updated and caused that issue.

Everyone who sees this, just make sure you have updated the package before you give up on debugging.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda